package com.xkdx.guangguang.fragment.login;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import android.content.Context;
import android.os.Build;
import android.telephony.TelephonyManager;

import com.xkdx.guangguang.module.network.AbsAction;
import com.xkdx.guangguang.module.statics.IConstants;

public class RegisterInfoAction extends AbsAction {

	String loginname;
	String loginpassword;
	private Context context;

	public RegisterInfoAction(Context context, String loginname,
			String loginpassword) {
		this.context = context;
		this.url = IConstants.LOGIN_URL;
		this.loginname = loginname;
		this.loginpassword = loginpassword;
		
	}

	@Override
	public void constructRequest() {

		// 获取手机号
		TelephonyManager mTelephonyManager = (TelephonyManager) context
				.getSystemService(context.TELEPHONY_SERVICE);
		String MobilePhone = mTelephonyManager.getLine1Number();
		// 获取设备串号
		String deviceSN = mTelephonyManager.getDeviceId();
		// 获取设备型号
		String deviceModel = Build.MODEL;
		// 获取系统版本
		String oSVersion = Build.VERSION.SDK;

		HashMap<String, String> loginmap = new HashMap<String, String>();
		loginmap.put("user_login_name", loginname);
//		loginmap.put("LoginID", loginname);
		loginmap.put("user_pass", loginpassword);
//		loginmap.put("Password", loginpassword);
		loginmap.put("devicetype", "2");
		loginmap.put("DeviceModel", deviceModel);
		loginmap.put("OSVersion", oSVersion);

		String loginJson = constructJson(loginmap);

		Parameter parameter = new Parameter("User", "Register", loginJson);
		List<Parameter> list = new ArrayList<Parameter>();
		list.add(parameter);

		requestData = constructMod(list);

	}
}
